#include "ThreadPool.hpp"
#include "Task.hpp"
#include <time.h>
#include <unistd.h>
#include <memory>
#include <cstdlib>

int main()
{
    EnableConsoleLogStrategy();
    srand(time(nullptr) ^ getpid());
    // std::unique_ptr<ThreadPool<Task>> tp = std::make_unique<ThreadPool<Task>>(5);
    
    // tp->Start();
    int cnt = 20;
    while (cnt--)
    {
        int x = rand() % 10 + 1;
        usleep(rand() % 73);
        int y = rand() % 5 + 1;
        Task t(x, y);
        ThreadPool<Task>::GetInstance()->Enqueue(t); // 提交任务到线程池
    }
    ThreadPool<Task>::GetInstance()->Stop();
    ThreadPool<Task>::GetInstance()->Wait();
    return 0;
}